<?php

/**
 * This is the model class for table "payee_information".
 *
 * The followings are the available columns in table 'payee_information':
 * @property string $payee_information_id
 * @property string $name_of_payee
 * @property string $icno
 * @property string $date_of_birth
 * @property string $relationship
 * @property string $bank
 * @property string $location
 * @property string $bank_account
 * @property string $account_name
 * @property string $bonus_payment_type
 * @property string $bonus_payment_currency
 */
class PayeeInformation extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @return PayeeInformation the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'payee_information';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('name_of_payee, icno, relationship, bank, bank_account, account_name, bonus_payment_type', 'length', 'max'=>255),
			array('location', 'length', 'max'=>512),
			array('bonus_payment_currency', 'length', 'max'=>7),
			array('date_of_birth', 'safe'),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('payee_information_id, name_of_payee, icno, date_of_birth, relationship, bank, location, bank_account, account_name, bonus_payment_type, bonus_payment_currency', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'payee_information_id' => 'Payee Information',
			'name_of_payee' => 'Name Of Payee',
			'icno' => 'Icno',
			'date_of_birth' => 'Date Of Birth',
			'relationship' => 'Relationship',
			'bank' => 'Bank',
			'location' => 'Location',
			'bank_account' => 'Bank Account',
			'account_name' => 'Account Name',
			'bonus_payment_type' => 'Bonus Payment Type',
			'bonus_payment_currency' => 'Bonus Payment Currency',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('payee_information_id',$this->payee_information_id,true);
		$criteria->compare('name_of_payee',$this->name_of_payee,true);
		$criteria->compare('icno',$this->icno,true);
		$criteria->compare('date_of_birth',$this->date_of_birth,true);
		$criteria->compare('relationship',$this->relationship,true);
		$criteria->compare('bank',$this->bank,true);
		$criteria->compare('location',$this->location,true);
		$criteria->compare('bank_account',$this->bank_account,true);
		$criteria->compare('account_name',$this->account_name,true);
		$criteria->compare('bonus_payment_type',$this->bonus_payment_type,true);
		$criteria->compare('bonus_payment_currency',$this->bonus_payment_currency,true);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}